home *** CD-ROM | disk | FTP | other *** search
/ Chip 2005 August (Alt) / CHIP 2005-08.1.iso / program / guvenlik / syslinux-3.07.exe / menu / simple.c < prev    next >
Encoding:
C/C++ Source or Header  |  2004-12-14  |  2.9 KB  |  81 lines

  1. /* -*- c -*- ------------------------------------------------------------- *
  2.  *   
  3.  *   Copyright 2004 Murali Krishnan Ganapathy - All Rights Reserved
  4.  *
  5.  *   This program is free software; you can redistribute it and/or modify
  6.  *   it under the terms of the GNU General Public License as published by
  7.  *   the Free Software Foundation, Inc., 53 Temple Place Ste 330,
  8.  *   Boston MA 02111-1307, USA; either version 2 of the License, or
  9.  *   (at your option) any later version; incorporated herein by reference.
  10.  *
  11.  * ----------------------------------------------------------------------- */
  12.  
  13. #ifndef NULL
  14. #define NULL ((void *) 0)
  15. #endif
  16.  
  17. #include "menu.h"
  18. #include "biosio.h"
  19. #include "string.h"
  20. #include "syslinux.h"
  21.  
  22. int menumain(char *cmdline)
  23. {
  24.   t_menuitem * curr;
  25.  
  26.   char TESTING,RESCUE,MAIN;    /* The menus we're going to declare */
  27.   (void)cmdline;        /* Not used */
  28.  
  29.   // Change the video mode here
  30.   // setvideomode(0)
  31.  
  32.   // Choose the default title and setup default values for all attributes....
  33.   init_menusystem(NULL);
  34.   set_window_size(1,1,23,78); // Leave one row/col border all around
  35.   
  36.   // Choose the default values for all attributes and char's
  37.   // -1 means choose defaults (Actually the next 4 lines are not needed)
  38.   //set_normal_attr (-1,-1,-1,-1); 
  39.   //set_status_info (-1,-1); 
  40.   //set_title_info  (-1,-1); 
  41.   //set_misc_info(-1,-1,-1,-1);
  42.   
  43.   // menuindex = add_menu(" Menu Title ");
  44.   // add_item("Item string","Status String",TYPE,"any string",NUM)
  45.   //   TYPE = OPT_RUN | OPT_EXITMENU | OPT_SUBMENU | OPT_CHECKBOX | OPT_INACTIVE
  46.   //   "any string" not used by the menu system, useful for storing kernel names
  47.   //   NUM = index of submenu if OPT_SUBMENU, 
  48.   //         0/1 default checked state if OPT_CHECKBOX
  49.   //         unused otherwise.
  50.  
  51.   TESTING = add_menu(" Testing ");
  52.   add_item("Self Loop","Go to testing",OPT_SUBMENU,NULL,TESTING);
  53.   add_item("Memory Test","Perform extensive memory testing",OPT_RUN, "memtest",0);
  54.   add_item("Exit this menu","Go one level up",OPT_EXITMENU,"exit",0);
  55.  
  56.   RESCUE = add_menu(" Rescue Options ");
  57.   add_item("Linux Rescue","linresc",OPT_RUN,"linresc",0);
  58.   add_item("Dos Rescue","dosresc",OPT_RUN,"dosresc",0);
  59.   add_item("Windows Rescue","winresc",OPT_RUN,"winresc",0);
  60.   add_item("Exit this menu","Go one level up",OPT_EXITMENU,"exit",0);
  61.  
  62.   MAIN = add_menu(" Main Menu ");  
  63.   add_item("Prepare","prep",OPT_RUN,"prep",0);
  64.   add_item("Rescue options...","Troubleshoot a system",OPT_SUBMENU,NULL,RESCUE);
  65.   add_item("Testing...","Options to test hardware",OPT_SUBMENU,NULL,TESTING);
  66.   add_item("Exit to prompt", "Exit the menu system", OPT_EXITMENU, "exit", 0);
  67.  
  68.   curr = showmenus(MAIN); // Initial menu is the one with index MAIN
  69.   if (curr)
  70.   {
  71.         if (curr->action == OPT_RUN)
  72.         {
  73.             if (syslinux) runcommand(curr->data);
  74.             else csprint(curr->data,0x07);
  75.             return 1;
  76.         }
  77.         csprint("Error in programming!",0x07);
  78.   }
  79.   return 0;
  80. }
  81.